package design.simdi.code.final_paper.core.entities;

import java.util.Date;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import design.simdi.code.final_paper.core.enums.MessageStatus;

@Entity
@Table(name = "mesaje")
@AttributeOverrides( { @AttributeOverride(name = "id", column = @Column(name = "Mesaj_Id")) })
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Mesaj extends ApplicationEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String title;
	private String content;
	private Date date;
	private Person destinatar;
	private Person expeditor;
	private MessageStatus status;

	@Column(length = 250, nullable = false, name = "Title")
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(length = 250, nullable = false, name = "Content")
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Column(nullable = false, name = "Date")
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@OneToOne
	@JoinColumn(name = "Destinatar_Fk")
	public Person getDestinatar() {
		return destinatar;
	}

	public void setDestinatar(Person destinatar) {
		this.destinatar = destinatar;
	}

	@OneToOne
	@JoinColumn(name = "Expeditor_Fk")
	public Person getExpeditor() {
		return expeditor;
	}

	public void setExpeditor(Person expeditor) {
		this.expeditor = expeditor;
	}

	@Column(nullable = false, name = "Status")
	public MessageStatus getStatus() {
		return status;
	}

	public void setStatus(MessageStatus status) {
		this.status = status;
	}

}
